//
// C++ Implementation: main
//
// Description:
//
//
// Author: Willi Ballenthin <wilbal1087@gmail.com>, (C) 2008
//
// Copyright: See COPYING file that comes with this distribution
//
//

#include "xmlconfig.h"

#include "activityeditwidget.h"
#include "activitytablemodel.h"
#include "activityviewwidget.h"
#include "mainactivitywidget.h"


#include <QApplication>
#include <QtCore>
#include <QtGui>
#include <QtSql>
#include <QDebug>

 int main(int argc, char *argv[])
 {
    QApplication app(argc, argv);
    QSqlDatabase* db;

    XMLConfig* xml = new XMLConfig();
    if(!xml->createDOM())
    {
        qFatal("Unable to create the Document Object Model");
    }

    if(!xml->matchConfigVersion("0.0.1"))
    {
        qFatal("Unable to match config file to current application version");
    }

    if(!xml->extractConfig())
    {
        qFatal("Unable to extract configuration details from file");
    }

    if((db = xml->getDB()) == 0)
    {
        qFatal("Unable to connect to database");
    }

    Activity* example = new Activity;
    example->setDB(db);

    MainActivityWidget main(db);
    main.show();

    return app.exec();
 }
